<?php

/**
 * This is the model class for table "{{task}}".
 *
 * The followings are the available columns in table '{{task}}':
 * @property double $task_id
 * @property double $exam_id
 * @property double $user_id
 * @property string $task_name
 * @property double $task_status
 * @property double $task_expired
 * @property double $time_created
 * @property double $create_user
 * @property double $create_time
 * @property double $update_user
 * @property double $update_time
 */
class Task extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Task the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{task}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('exam_id, user_id, task_status, task_expired, time_created, create_user, create_time, update_user, update_time', 'numerical'),
			array('task_name', 'length', 'max'=>225),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('task_id, exam_id, user_id, task_name, task_status, task_expired, time_created, create_user, create_time, update_user, update_time', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'task_id' => 'Task',
			'exam_id' => 'Exam',
			'user_id' => 'User',
			'task_name' => 'Task Name',
			'task_status' => 'Task Status',
			'task_expired' => 'Task Expired',
			'time_created' => 'Time Created',
			'create_user' => 'Create User',
			'create_time' => 'Create Time',
			'update_user' => 'Update User',
			'update_time' => 'Update Time',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('task_id',$this->task_id);
		$criteria->compare('exam_id',$this->exam_id);
		$criteria->compare('user_id',$this->user_id);
		$criteria->compare('task_name',$this->task_name,true);
		$criteria->compare('task_status',$this->task_status);
		$criteria->compare('task_expired',$this->task_expired);
		$criteria->compare('time_created',$this->time_created);
		$criteria->compare('create_user',$this->create_user);
		$criteria->compare('create_time',$this->create_time);
		$criteria->compare('update_user',$this->update_user);
		$criteria->compare('update_time',$this->update_time);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}